#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

class App {
	int cnt = 1;
	vector<int> head, next, to;
	vector<int> father, diameter;
	vector<int> dist;

	int find(int x)
	{
		return father[x] == x ? x : father[x] = find(father[x]);
	}

	void addedge(int u, int v)
	{
		next[cnt] = head[u];
		to[cnt] = v;
		head[u] = cnt++;
	}

	int dp_meter(int u, int p)
	{
		dist[u] = 0;
		int diameter = 0;
		for (int e = head[u], v = to[e]; e; e = next[e], v = to[e]) {
			if (v != p) {
				diameter = max(diameter, dp_meter(v, u));
				diameter = max(diameter, dist[u] + dist[v] + 1);
				dist[u] = max(dist[u], dist[v] + 1);
			}
		}
		return diameter;
	}

	int dp(int u, int p)
	{
		dist[u] = 0;
                int ans = 0;
		for (int e = head[u], v = to[e]; e; e = next[e], v = to[e]) {
			if (v != p) {
				ans = max(ans, dp(v, u));
			}
		}

		for (int e = head[u], v = to[e]; e; e = next[e], v = to[e]) {
			if (v != p) {
				ans = max(ans, dist[u] + dist[v] + 1);
				dist[u] = max(dist[u], dist[v] + 1);
			}
		}
		return ans;
	}

    public:
	App(int n, int m, int q) : head(n + 1, 0), next(n << 1, 0), to(n << 1, 0), father(n + 1, 0), diameter(n + 1, 0), dist(n + 1, 0)
	{
		for (int i = 0; i <= n; i++) {
			father[i] = i;
		}

		for (int i = 0, u, v; i < m; i++) {
			cin >> u >> v;
			addedge(u, v);
			addedge(v, u);

			u = find(u);
			v = find(v);
			father[u] = v;
		}

		for (int i = 1; i <= n; i++) {
			if (father[i] == i) {
				//diameter[i] = dp_meter(i, 0);
				diameter[i] = dp(i, 0);
			}
		}

		for (int i = 0, op, u, v; i < q; i++) {
			cin >> op;
			if (op == 1) {
				cin >> u;
				u = find(u);
				cout << diameter[u] << endl;
			} else {
				cin >> u >> v;

				u = find(u);
				v = find(v);
				if (u != v) {
					father[u] = v;
					int meter = max({ ((diameter[u] + 1) / 2 + (diameter[v] + 1) / 2 + 1), diameter[u], diameter[v] });
					App::diameter[v] = meter;
				}
			}
		}
	}
};

int main()
{
	int n = 0, m = 0, q = 0;
	cin >> n >> m >> q;
	App app(n, m, q);
	return 0;
}